<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>商品修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/assets/framework/lib/layui-v2.8.17/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/assets/framework/css/public.css}" media="all">
    <link rel="stylesheet" th:href="@{/assets/framework/lib/wangeditor/wangeditor_5.1.23.css}">
    <style>
        body {
            background-color: #ffffff;
        }
        #editor—wrapper {
            border: 1px solid #ccc;
            z-index: 100;
        }

        #toolbar-container {
            border-bottom: 1px solid #ccc;
        }

        #editor-container {
            height: 400px;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" lay-filter="good-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">商品编码</label>
        <div class="layui-input-block">
            <input type="text" name="spuNo" lay-verify="required" lay-reqtext="商品编码不能为空"
                   placeholder="请输入商品编码" th:value="${good?.spuNo}" class="layui-input" autocomplete="off">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">商品名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" lay-reqtext="商品名称不能为空"
                   placeholder="请输入商品名称" th:value="${good?.name}" class="layui-input" autocomplete="off">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">商品主图</label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn" id="pic-upload-btn">
                <i class="layui-icon layui-icon-upload"></i>商品主图
            </button>
            <div style="width: 120px;">
                <div class="layui-upload-list">
                    <img class="layui-upload-img"
                         id="pic_preview" style="width: 100%; height: 110px;">
                </div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">商品类别</label>
        <div class="layui-input-block">
            <input type="text" name="category.id" id="categoryId"
                   placeholder="请选择商品类别" value=""
                   class="layui-input" autocomplete="off" lay-filter="categoryId">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">标价</label>
        <div class="layui-input-block">
            <input type="text" name="markPrice"
                   placeholder="请输入商品标价" th:value="${good?.markPrice}" class="layui-input" autocomplete="off">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">实售价</label>
        <div class="layui-input-block">
            <input type="text" name="price" lay-verify="required" lay-reqtext="实售价不能为空"
                   placeholder="请输入商品实售价" th:value="${good?.price}" class="layui-input" autocomplete="off">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">是否热销</label>
        <div class="layui-input-block">
            <input type="radio" name="isBestSeller" value="1" title="是">
            <input type="radio" name="isBestSeller" value="0" title="否" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否新品</label>
        <div class="layui-input-block">
            <input type="radio" name="isNewProduct" value="1" title="是">
            <input type="radio" name="isNewProduct" value="0" title="否" checked>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否下架</label>
        <div class="layui-input-block">
            <input type="radio" name="isTakeOff" value="1" title="是">
            <input type="radio" name="isTakeOff" value="0" title="否" checked>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="description" class="layui-textarea" placeholder="请输入备注信息"
                      th:text="${good?.description}"></textarea>
        </div>
    </div>

    <!--富文本编辑器，详情-->
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">商品详情</label>
        <div class="layui-input-block">
            <div id="editor—wrapper">
                <div id="toolbar-container"><!-- 工具栏 --></div>
                <div id="editor-container"><!-- 编辑器 --></div>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="save-btn">确认保存</button>
            <input type="hidden" name="id" th:value="${good?.id}">
        </div>
    </div>
</div>
<script th:src="@{/assets/framework/lib/layui-v2.8.17/layui.js}" charset="utf-8"></script>
<script th:src="@{/assets/framework/lib/treeselect/treeSelect.js}"></script>
<script th:src="@{/assets/framework/lib/wangeditor/wangeditor_5.1.23.js}"></script>
<script th:inline="javascript">
    let ctx = /*[[@{/}]]*/"";
    if (ctx.endsWith("/")) {
        ctx = ctx.substring(0, ctx.length - 1);
    }
    const error = /*[[${error}]]*/"";
    const good = /*[[${good}]]*/{};
</script>
<script th:src="@{/assets/good/edit.js}"></script>
</body>
</html>